<!DOCTYPE html>
<html lang="en">
{include file="Public/head"}
<!-- 图片上传 -->
<!--引入CSS-->
<link rel="stylesheet" type="text/css" href="/static/webuploader/webuploader.css">
<style>
    ul.group-list li {
        white-space: nowrap;float: left;
        width: 150px; height: 25px;
        padding: 3px 5px;list-style-type: none;
        list-style-position: outside;border: 0px;margin: 0px;
    }
    input[type=checkbox], input[type=radio] {
        display: inline-block;
    }
    .am-u-sm-2{
        float: left;
    }

</style>


<body data-type="widgets">
<script src="/assets/js/theme.js"></script>
<div class="am-g tpl-g">

    {include file='Public:header'}
    {include file='Public:menu2'}



    <!-- 内容区域 -->
    <div class="tpl-content-wrapper" >
        <div class="row-content am-cf">
            <div class="row">

                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title am-fl">品牌新增修改</div>
                            <div class="widget-function am-fr">
                                <div class="navbar-form pull-right margin">
                                    <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
                                </div>
                            </div>
                        </div>
                        <div class="widget-body am-fr">

                            <form action="{:Url('/Admin/Brand/edit')}" id="category_form"  class="am-form tpl-form-border-form tpl-form-border-br" method="post">
                                <div class="am-form-group form-shou">
                                    <label class="am-u-sm-4 am-form-label">品牌名称 </label>
                                    <div class="am-u-sm-4" >
                                        <input type="text" class="tpl-form-input" name="name" value="{$cat_list.name}" >
                                    </div>
                                </div>
                                <div class="am-form-group form-shou">
                                    <label class="am-u-sm-4 am-form-label">品牌网址</label>
                                    <div class="am-u-sm-4" >
                                        <input type="text" class="tpl-form-input" name="address" value="{$cat_list.url}">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="am-u-sm-4 am-form-label">上级分类</label>
                                    <div class="am-u-sm-4 am-form-label">
                                        <select name="parent_id_1" id="parent_id_1" onchange="get_category(this.value,'parent_id_2','0')" class="am-u-sm-4"  style="width:200px;margin-top: -8px;">
                                            <option value="0" name="">顶级分类</option>
                                            {foreach $list as $k=>$v}
                                            <option value="{$v.id}" {if condition="$v.id eq $cat_list.parent_cat_id"} selected="selected" {/if}>{$v.name}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                    <div class="am-u-sm-4 am-form-label">
                                        <select name="parent_id_2" id="parent_id_2" class="am-u-sm-4" style="width:200px;margin-left: -130px;margin-top: -8px; ">
                                            <option value="0">请选择分类</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="am-form-group"  >
                                    <label class="am-u-sm-4 am-form-label" style="margin-top:10px; ">品牌logo</label>
                                    <div class="am-u-sm-8">
                                        <input type="hidden" name="image" value="1" id="image">
                                        <input type="hidden" name="img" value="{$cat_list.logo}" id="img">
                                        <img src="{if $cat_list.logo}{$cat_list.logo} {else}/static/images/no_image.jpg{/if}" width="150" style="border:1pt solid #F6F6F6;">
                                        <div id="uploader1"  style="position: absolute;top:0px;left:220px;">
                                            <span id="filepicker1"class="btn">选择图片</span>
                                            <div class="uploader-list"></div>
                                        </div>
                                    </div>
                                </div>
                                <div class="am-form-group form-shou">
                                    <label class="am-u-sm-4 am-form-label">品牌排序</label>
                                    <div class="am-u-sm-4" >
                                        <input type="text" class="tpl-form-input" name="order" value="{$cat_list.order}" >
                                        <!--<small>请填写6位以上英文或数字。</small>-->
                                    </div>
                                </div>
                                <div class="am-form-group form-shou">
                                    <label class="am-u-sm-4 am-form-label">品牌描述</label>
                                    <div class="am-u-sm-4" >
                                        <textarea style="width: 500px;height:100px;" class="form-control" rows="3" placeholder="请输入内容" name="content">{$cat_list.descripition}</textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <input type="hidden" name="id" value="{$cat_list.id}">
                                    <button type="button" onclick="ajax_submit_form('category_form','{:Url('Brand/edit')}');" class="am-btn am-btn-secondary" style="float: right"><i class="icon-ok"></i>提交</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<script src="/layer/layer.js"></script>
<script src="/js/global.js"></script>
<script src="/js/myFormValidation.js"></script>
<script src="/js/myAjax.js"></script>
<script src="http://cdn.bootcss.com/amazeui/2.7.2/js/amazeui.min.js"></script>
<script src="/assets/js/amazeui.datatables.min.js"></script>
<script src="/assets/js/dataTables.responsive.min.js"></script>
<script src="/assets/js/app.js"></script>
<!--图片引入JS-->
<script type="text/javascript" src="/static/webuploader/webuploader.js"></script>
<script type="text/javascript" src="/static/webuploader/webuploader.min.js"></script>
<script type="text/javascript" src="/static/js/uploader.js"></script>
<script>

    //图片上传
    var uploader1;
    var arr1 = {
        'container':'#uploader1',
        'pick':'#filepicker1',
        'server':"{:url('webuploader')}",
        successHandler:function(file,response){
            var $input = $("input[name=image]");
            $input.val(response.link);
            $input.siblings("img").attr("src",response.link);
        }
    };

    if(!uploader1){
        uploader1 = getUploader(arr1);
    }

    window.onload = function(){
            get_category($("#parent_id_1").val(),'parent_id_2',{$cat_list.cat_id});
    }
</script>
</body>
</html>